package morenoapp.model.impl.index;

import morenoapp.model.data.MorenoModelFace;
import morenoapp.model.index.MorenoIndex;
import morenoapp.util.I18N;

/**
 *
 * @author dmitry.mamonov
 */
public abstract class MorenoAbstractIndexImpl implements  MorenoIndex{
    private MorenoModelFace model;
    private String type;
    private String name = null;
    private String formula = null;
    private String description = null;

    public MorenoAbstractIndexImpl(MorenoModelFace _model, String _type) {
        assert _model!=null;
        assert _type!=null;
        this.model = _model;
        this.type = _type;
    }
    
    protected MorenoModelFace getModel() {
        return model;
    }

    @Override
    public String getName() {
        if (name==null){
            name = I18N.get("index."+getClass().getSimpleName()+".name");
        }
        return name;
    }

    @Override
    public String getFormula() {
        if (formula==null){
            formula = I18N.get("index."+getClass().getSimpleName()+".name");
        }
        return formula;
    }

    @Override
    public String getDescription() {
        if (description==null){
            description = I18N.get("index."+getClass().getSimpleName()+".name");
        }
        return description;
    }
}
